package com.zc.study.thread.多线程第四章节.thread4_2_1;

/**
 * 读写锁
 */
public class Run {
    public static void main(String[] args) {
        Service service = new Service();
        ThreadRead[] threadReads = new ThreadRead[10];
        ThreadWrite[] threadWrites = new ThreadWrite[10];
        for(int i=0;i<10;i++){
            threadReads[i] = new ThreadRead(service);
            threadWrites[i] = new ThreadWrite(service);
            threadReads[i].setName("read"+i);
            threadWrites[i].setName("write"+i);
        }
        for(int i=0;i<10;i++){
            threadReads[i].start();
            threadWrites[i].start();
        }

    }
}
